package com.my.config.error;

import com.my.result.ResultCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @author : jhxue
 * @create_time : 2024/4/9 16:22
 * @description : 基础异常
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class BaseException extends RuntimeException {

    private Integer code;

    private String msg;

    public BaseException(String msg) {
        this.msg = msg;
    }

    public BaseException(ResultCode resultCode) {
        this.msg = resultCode.getMsg();
        this.code = resultCode.getCode();
    }

    public BaseException(ResultCode resultCode, String msg) {
        this.code = resultCode.getCode();
        this.msg = msg;
    }
}
